package windbell.domain.risk.events;

import edu.fudan.mylang.pf.event.EntityEventsManager;
import java.util.Collection;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import windbell.domain.risk.RiskCheckTemplate;
import windbell.domain.risk.RiskCheckTemplateItem;
import windbell.domain.risk.events.RiskCheckTemplateEventsListener;

@Service("windbell.domain.risk.events.RiskCheckTemplateEventsManager")
public class RiskCheckTemplateEventsManager extends EntityEventsManager<RiskCheckTemplate> {
  @Autowired(required = false)
  private Collection<RiskCheckTemplateEventsListener> listeners = com.google.common.collect.Lists.newArrayList();;
  
  protected Collection<RiskCheckTemplateEventsListener> getListeners() {
    return listeners;
  }
  
  public void fireUpdate(final RiskCheckTemplate entity, final Procedure1<? super RiskCheckTemplate> updater) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((RiskCheckTemplateEventsListener)listener).update(entity,updater);
    }
    
  }
  
  public void fireDelete(final RiskCheckTemplate entity) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((RiskCheckTemplateEventsListener)listener).delete(entity);
    }
    
  }
  
  public void fireAddCheckItem(final RiskCheckTemplate entity, final RiskCheckTemplateItem item) {
    for (edu.fudan.mylang.pf.event.IEntityEventsListner<?> listener : listeners) {
    	((RiskCheckTemplateEventsListener)listener).addCheckItem(entity,item);
    }
    
  }
}
